import { Controller, Get, Post, Body, Patch, Param, Delete, Query } from "@nestjs/common";
import { RoleService } from "./role.service";
import { CreateRoleDto } from "./dto/create-role.dto";
import { UpdateRoleDto } from "./dto/update-role.dto";

@Controller("roles")
export class RoleController {
	constructor(private readonly rolesService: RoleService) {
	}
	
	@Post()
	create(@Body() createRoleDto: CreateRoleDto) {
		return this.rolesService.create(createRoleDto);
	}
	
	@Get()
	findAll(@Query() dto) {
		return this.rolesService.findAll(dto);
	}
	
	@Get(":id")
	findOne(@Param("id") id: string) {
		return this.rolesService.findOne(+id);
	}
	
	@Patch(":id")
	update(@Param("id") id: string, @Body() updateRoleDto: UpdateRoleDto) {
		return this.rolesService.update(+id, updateRoleDto);
	}
	
	@Delete(":id")
	remove(@Param("id") id: string) {
		return this.rolesService.remove(+id);
	}
	
}
